<?
class AdminRightsBO extends BusinessObject {
	var $aFileRights = array(
		'/admin/categories.php'=>1,
		'/admin/categories-save.php'=>1,
		'/admin/pages.php'=>1,
		'/admin/folders.php'=>1,
		'/admin/folders-save.php'=>1,
		'/admin/folder-list.php'=>1,
		'/admin/articles.php'=>1,
		'/admin/newsletter.php'=>1,
		'/admin/m_orders_list.php'=>3,
		'/admin/m_users_list.php'=>3,
		'/admin/m_itcategory_list.php'=>2,
		'/admin/m_items_list.php'=>2,
		'/admin/price_tags.php'=>2,
		'/admin/m_discounts_list.php'=>2,
		'/admin/m_site_edit.php'=>2,
		'/admin/m_vouchers_list.php'=>2,
		'/admin/m_coupons_list.php'=>1,
		'/admin/m_emails_list.php'=>1,
		'/admin/m_empls_list.php'=>3,
		'/admin/m_affiliates_list.php'=>4,
		'/admin/m_concierges_list.php'=>5,
		'/admin/m_xml_prtnrs_list.php'=>6,
		'/admin/m_providers_list.php'=>2,
		'/admin/seo.php'=>1,
		'/admin/m_guestbook_list.php'=>1,
		'/admin/m_logs_list.php'=>99, //--admin
		'/admin/m_admin_edit.php'=>0,
		'/admin/help.php'=>0,
		'/admin/m_bshow_list.php'=>2,
		'/admin/custom_service_list.php'=>7,
		'/admin/driver_list.php'=>7,
		'/admin/m_search_keywords.php'=>8,
		'/admin/m_sales_list.php'=>8,
		'/admin/m_sales_analysis.php'=>8,
		'/admin/m_sales_charts.php'=>8,
		'/admin/m_redemptions_list.php'=>8,
		'/admin/m_peoples_list.php'=>8,
		'/admin/m_cancel_list.php'=>8,
		'/admin/m_affiliates_top.php'=>8,
		'/admin/m_affiliates_report.php'=>8,
		'/admin/m_affiliates_clicks.php'=>8,
		'/admin/m_redaffiliates_report.php'=>8,
		'/admin/m_concierges_report.php'=>8,
		'/admin/m_concierges_report0.php'=>8,
		'/admin/m_concierges_report1.php'=>8,
		'/admin/m_redconcierges_report.php'=>8,
		'/admin/m_agents_report.php'=>8,
		'/admin/m_mail_reports.php'=>8,
		'/admin/m_mail_reports_edit.php'=>8,
		'/admin/m_upgrades_statistic.php'=>8,
		'/admin/quote_list.php'=>8,
		'/admin/admins_rights.php'=>99, // --admin
		'/admin/gcadmin.php'=>99,
		'/admin/main.php'=>0,
		'/admin/menu.php'=>0,
		'/admin/menu_old.php'=>0,
		'/admin/login.php'=>0,
		'/admin/logout.php'=>0,
		
		
		'/admin/account_create_image.php'=>0,
		'/admin/article-album-edit.php'=>1,
		'/admin/article-album-update-image.php'=>1,
		'/admin/article-banner-edit.php'=>1,
		'/admin/article-edit.php'=>1,
		'/admin/article-frame.php'=>1,
		'/admin/article-type-select.php'=>1,
		'/admin/articles-block.php'=>1,
		'/admin/banner-edit.php'=>0,
		'/admin/banners.php'=>0,
		'/admin/blank.php'=>0,
		'/admin/categories_oper.php'=>1,
		'/admin/category-edit.php'=>1,
		'/admin/category-list.php'=>1,
		'/admin/class.ezpdf.php'=>0,
		'/admin/class.pdf.php'=>0,
		'/admin/Coupon.class.php'=>1,
		'/admin/daily-discount-save.php'=>0,
		'/admin/doajaxfileupload_item.php'=>0,
		'/admin/driver_view.php'=>7,
		'/admin/duplicate.php'=>0,
		'/admin/excel.php'=>0,
		'/admin/file-edit.php'=>0,
		'/admin/files.php'=>0,
		'/admin/files_insert.php'=>0,
		'/admin/fix.php'=>0,
		'/admin/gcollector.php'=>0,
		'/admin/index.php'=>0,
		'/admin/items.php'=>2,
		'/admin/items_assoc.php'=>2,
		'/admin/item_featured.php'=>2,
		'/admin/item_featured_pos_save.php'=>2,
		'/admin/item_package_save.php'=>2,
		'/admin/item_pos_save.php'=>2,
		'/admin/m_admin_list.php'=>0,
		'/admin/m_affiliate_edit.php'=>0,
		'/admin/m_blackouts_list.php'=>0,
		'/admin/m_bshow_upload_image.php'=>0,
		'/admin/m_combo.php'=>0,
		'/admin/m_combo_down.php'=>0,
		'/admin/m_combo_up.php'=>0,
		'/admin/m_concierge_edit.php'=>5,
		'/admin/m_conf.php'=>0,
		'/admin/m_coupon_download.php'=>1,
		'/admin/m_dailyprices_list.php'=>0,
		'/admin/m_email_edit.php'=>1,
		'/admin/m_email_preview.php'=>1,
		'/admin/m_empl_edit.php'=>3,
		'/admin/m_guestbook_edit.php'=>1,
		'/admin/m_itcategory_edit.php'=>2,
		'/admin/m_itcategory_items.php'=>2,
		'/admin/m_items_fulllist.php'=>2,
		'/admin/m_item_edit.php'=>2,
		'/admin/m_item_image_upload.php'=>2,
		'/admin/m_item_option_add.php'=>2,
		// '/admin/m_logs_edit.php'=>0, 
		// '/admin/m_order_edit.php'=>0,
		// '/admin/m_product_blackouts.php'=>0,
		// '/admin/m_product_discount.php'=>0,
		// '/admin/m_product_related.php'=>0,
		// '/admin/m_product_upgrades.php'=>0,
		// '/admin/m_product_upgrades_edit.php'=>0,
		// '/admin/m_prod_rel_down.php'=>0,
		// '/admin/m_prod_rel_up.php'=>0,
		// '/admin/m_providers_products.php'=>0,
		// '/admin/m_provider_edit.php'=>0,
		// '/admin/m_prov_prod_down.php'=>0,
		// '/admin/m_prov_prod_up.php'=>0,
		// '/admin/m_sales_chart.php'=>0,
		// '/admin/m_sites_list.php'=>0,
		// '/admin/m_user_edit.php'=>0,
		'/admin/m_voucher_copy.php'=>2,
		'/admin/m_voucher_edit.php'=>2,
		'/admin/m_voucher_image_edit.php'=>2,
		'/admin/m_voucher_image_upload.php'=>2,
		'/admin/m_voucher_preview.php'=>2,
		'/admin/m_voucher_resend.php'=>2,
		'/admin/m_xml_prtnrs_edit.php'=>6,
		'/admin/page-edit.php'=>1,
		'/admin/price.php'=>0,
		'/admin/print_vouchers.php'=>0,
		'/admin/prod-blackout-save.php'=>0,
		'/admin/prod-discount-save.php'=>0,
		'/admin/p_tags.php'=>0,
		'/admin/quote.php'=>0,
		'/admin/quote_view.php'=>0,
		'/admin/reports.php'=>0,
		'/admin/reservations.php'=>0,
		'/admin/send-reminders.php'=>0,
		'/admin/send_report.php'=>0,
		'/admin/set-reminders-config.php'=>0,
		'/admin/short_report.php'=>0,
		'/admin/site-blackouts-save.php'=>0,
		'/admin/site-discount-save.php'=>0,
		'/admin/specials.php'=>0,
		'/admin/test.php'=>0,
		'/admin/tour_.php'=>0,
		'/admin/upload.php'=>0,
		'/admin/verify.php'=>0,
		'/admin/_category-list.php'=>0,
		'/admin/_m_affiliates_report.php'=>0,
		'/admin/_m_orders_list.php'=>0,
		'/admin/m_publick_login.php'=>0,
		'/admin/_m_sales_list.php'=>0

	);
	
	var $aRightsName = array(
        //0=>'For all',   --- abstract right
		1=>'Edit pages',
        2=>'Items + Category + TourProviders',
        3=>'Agents + Employees',
        4=>'Affilietes',
        5=>'Concierge',
        6=>'XML partners',
        7=>'CAREER OPPORTUNITIES',
        8=>'Reports'
	);
	  
	var $aRights = array (
	    1=>FALSE,
        2=>FALSE,
        3=>FALSE,
        4=>FALSE,
        5=>FALSE,
        6=>FALSE,
        7=>FALSE,
        8=>FALSE
    );

	
	function AdminRightsBO() {
	  BusinessObject::BusinessObject("admin_rights");
	  $this->setAttributes();
	}
		
	function setAttributes(){
		$this->fields	= array(
		'id'		 => 'id',
		'adminID'   => 'adminID',
		'rightsID'   => 'rightsID'
		);
		
		BusinessObject::setAttributes();
    }	
		
	function getRights($adminId="") {
		$admin = new AdminBO();
		if ($adminId!="") $admin->id = $adminId;
		$admin->Load();
		$admin->Next();
		if ($admin->sa=="1") 
			foreach ($this->aRights as &$right) {$right=TRUE;}
		else 
			{
			$admRight = new AdminRightsBO();
			$admRight->adminID = $adminId;
			$admRight->Load();
			while ($admRight->Next()) {
				$this->aRights[$admRight->values['rightsID']]=TRUE;
				}
			}
		
	}
 	
	
 	
}	
?>